/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#include "PrimitiveAnimationBase.h"
#include <logs/Log.h>

namespace liba {
namespace animate {

bool PrimitiveAnimationBase::on_attribute(xml::Provider * prov, const std::string & name, const std::string & value )
{
	if( name == "Target" )
	{
		return converter::convert( value, &target_path );
	}
	if( name == "Param" )
	{
		return converter::convert( value, &param_name );
	}
	return false;
}

bool PrimitiveAnimationBase::bind(Node * animation_root, bool recursion )
{
	target = animation_root->FindAnimateNode( target_path, recursion );

	if( !target )
		LOG_WARN("PrimitiveAnimationBase", "PrimitiveAnimationBase::bind failed. path=\"%s\"", target_path.get_str().c_str());

	return target != 0;
}

} // namespace animate
} // namespace liba

